﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using Search;


namespace TripLOA.GUI.FullTextSearch
{
    /// <summary>
    /// An FullTextSearchProperties contains all the properties relate to the last
    /// search performed by the user, such as the term searched, an optional suggestion,
    /// the list of results and the number of results to display in each page (chosen by the user).
    /// </summary>
    public class FullTextSearchProperties
    {
        #region Costants

        /// <summary>
        /// Max number of results to display.
        /// </summary>
        public const int MAX_RESULTS = 300;

        #endregion


        #region Enumerations

        /// <summary>
        /// Enumeration related to the ResultsPerPage property.
        /// </summary>
        public enum ResultsPerPageEnum : int
        {
            Option1 = 20,
            Option2 = 50,
            Option3 = 100
        };

        #endregion


        #region Private variables

        private string _query; // The term searched by the user.
        private string _suggestion; // An optional search suggestion.
        private List<FullTextResult> _resList; // The list of results for the last search.
        private ResultsPerPageEnum _resPerPage; // The number of results to display in each page.

        #endregion


        #region Constructor
        /// <summary>
        /// Constructor
        /// </summary>
        public FullTextSearchProperties()
        {
            _query = null;
            _suggestion = null;
            _resList = null;
            _resPerPage = ResultsPerPageEnum.Option1;
        }
        #endregion


        #region Properties

        #region Query
        /// <summary>
        /// Sets or gets the term searched by the user.
        /// </summary>
        public string Query
        {
            set { _query = value; }
            get { return _query; }
        }
        #endregion


        #region Suggestion
        /// <summary>
        /// Sets or gets a search suggestion.
        /// </summary>
        public string Suggestion
        {
            set { _suggestion = value; }
            get { return _suggestion; }
        }
        #endregion


        #region ResultsList
        /// <summary>
        /// Sets or gets the list of results for the last search.
        /// </summary>
        public List<FullTextResult> ResultsList
        {
            set { _resList = value; }
            get { return _resList; }
        }
        #endregion


        #region ResultsPerPage
        /// <summary>
        /// Sets or gets the number of results to display in each page.
        /// </summary>
        public ResultsPerPageEnum ResultsPerPage
        {
            set { _resPerPage = value; }
            get { return _resPerPage; }
        }
        #endregion

        #endregion
    }
}
